<template>
  <div>
    <div style="margin:5px;" v-for="(value, key) in ruleValues" :key="key">
      {{ m(f(key)) }}: {{ transform(value) }}
    </div>
  </div>
</template>

<script>
import { m, f } from "@/store/yg/common/local";

export default {
  props: ["row", "data", "more"],
  computed: {
    ruleValues() {
      if (this.data["permissionJson"]) {
        var v = JSON.parse(this.data["permissionJson"]);
        return v;
      }
      return {};
    }
  },
  methods: {
    transform(value) {
      var options = this.$store.state.main.entry.sources["roleSource"];

      var result = "[ ";
      for (var i = 0; i < value.length; ++i) {
        result += options[value[i]];
        if (i < value.length - 1) {
          result += ", ";
        }
      }
      result += " ]";

      return result;
    },
    m(k) {
      return m(k);
    },
    f(k) {
      return f(k);
    }
  }
};
</script>
